#pragma once

#include "LuaCommon.h"

#ifdef USE_CAIRO
namespace LuaGui {
	class LuaPaint
	{
	public:
		static void Register(lua_State* L);

		static LuaGui::Paint* GetPaint();
		static void DrawPoint(double x, double y);
		static void MoveTo(double x, double y);
		static void LineTo(double x, double y);
		static void DrawLine(double x1, double y1, double x2, double y2, bool stroke);
		static void DrawTriangle(double x1, double y1, double x2, double y2, double x3, double y3, bool fill, bool stroke);
		static void DrawCurve(double x1, double y1, double x2, double y2, double x3, double y3, bool fill, bool stroke);
		static void DrawRectangle(double x, double y, double w, double h, bool fill, bool stroke);
		static void DrawArc(double cx, double cy, double radius, double angle1, double angle2, bool fill, bool stroke);
		static void DrawPolygon(std::vector<double> points, bool fill, bool stroke);
		static void DrawText(double x, double y, double w, double h, const char* utf8, const int x_align, const int y_align, bool is_clip);
		static double GetTextWidth(const char* text, double font_size);
		static void DrawNineImage(double x, double y, double w, double h, const char* utf8_png_filename, double l = 0, double t = 0, double r = 0, double b = 0);
		static void DrawImage(double x, double y, double w, double h, const char* utf8_png_filename, bool is_scale);
		static void SetFontSize(unsigned int font_size);
		static void SetFontColor(unsigned int color);
		static void SetPenColor(unsigned int color);
		static void SetLineWidth(unsigned int line_width);
		static void SetBrushColor(unsigned int color);

		// stroke fill
		static void Fill();
		static void Stroke();

		// Transformation
		static void Translate(double tx, double ty);
		static void Scale(double sx, double sy);
		static void Rotate(double angle);

		// Clip
		static void Clip();
		static void Save();
		static void Restore();

		static void Clear();
		// Flush
		static void Flush();
	};
}

#else

namespace LuaGui {
	class LuaPaint
	{
	public:
		static void Register(lua_State* L) {}
	};
}
#endif // USE_CAIRO

